<?php	
	include "common.php";	
	session_start();
	error_reporting(0);
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$userLink = $_SESSION['userLink'];
	if($userLink!="hrpage.php"){
		echo "Sorry, You have no right to visit this page!!";
		exit;
	}
		$eid = $_POST['e_id'];
		$role = $_POST['role'];
		$fname = $_POST['f_name'];
		$lname = $_POST['l_name'];
		$em = $_POST['email'];
		$contactI = $_POST['cnt1'];
		$contactII = $_POST['cnt2'];
		if($contactII=="")$contactII="Unknown";
		$blood = $_POST['blood'];
		$passw = $_POST['pass'];
		$spv = $_POST['super'];
		$addr = $_POST['add'];
		$jd = $_POST['j_date'];
		$d_id = 0;
		$myFile = "officeTime.txt";
		$fh = fopen($myFile, 'r');
		$theData = fread($fh, filesize($myFile));
		fclose($fh);
		$theData;
		$time=explode(".",$theData);
		$hour=$time[0];
		$minuite=$time[1];		
		$checkForSameIdMoreTime = "SELECT * FROM user WHERE e_id='$eid'";
		$checkForSameIdMoreTimeQuery = mysql_query($checkForSameIdMoreTime);
		$checkForSameIdMoreTimeResult = mysql_num_rows($checkForSameIdMoreTimeQuery);
		//$stts = $_POST['status'];
	
		$sql = "INSERT INTO user (e_id,role, f_name, l_name, email, contact1, contact2, password, supervisor,blood_group, address,office_hour,office_minute,t_late, dept_id, status) 
		VALUES ('$eid','$role', '$fname', '$lname', '$em', '$contactI', '$contactII', '$passw', '$spv','$blood', '$addr','$hour','$minuite','0','$d_id', 'active')";
		
		$sqlQuery = mysql_query($sql);
		
		$earnCasualLeaveInsert = "INSERT INTO `hr_db`.`earn_casual_leave` (
		`id` ,
		`e_id` ,
		`t_earn_l` ,
		`enjoyed` ,
		`available_leave` ,
		`t_casual_l` ,
		`c_enjoyed` ,
		`c_avail` ,
		`sick_l` ,
		`Jan` ,
		`Feb` ,
		`Mar` ,
		`Apr` ,
		`May` ,
		`Jun` ,
		`Jul` ,
		`Aug` ,
		`Sep` ,
		`Oct` ,
		`Nov` ,
		`Dec` ,
		`is_delete` ,
		`status`
		)
		VALUES (
		'', '$eid', '10', '0', '10', '15', '0', '15', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1'
		);

		";
		$earnCasualLeaveInsertSql = mysql_query($earnCasualLeaveInsert);
		
		$insertWarningTable = "INSERT INTO warningtableforabsent (e_id, warning) VALUES ('$eid','0')";
		$insertWarningTableSql = mysql_query($insertWarningTable);
		
		$insertNoticeShowedTable = "INSERT INTO notice_showed (e_id, status) VALUES ('$eid','0')";
		$insertNoticeShowedTableSql = mysql_query($insertNoticeShowedTable);
		
		
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="show_report.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<div class="new_notification">
        	<img src="images/arrow_up.JPG" /><p>You have a new notification</p>
        </div><!--end of new_notification-->
    	<ul>
        	<a href="hrpage.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_employee.php"><li><div id="employee"></div><p>employee</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_onduty.php"><li><div id="onduty"></div><p>on duty</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="hr_black_box_message.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="#"><li><div id="hrpolicy"></div><p>hr policy</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" border="none"/></p></li></a>
        </ul>
    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>view as: <a href="hr_employee_lists.php">lists</a> | <a href="update_user.php">add</a></p>
</div><!-- end of othrpage_1-->
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->
<div>
Succesfully Inserted
</div>
</body>
</html>
